package com.itheima.mapper;

import com.itheima.pojo.Clazz;
import com.itheima.pojo.ClazzQueryParam;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ClazzMapper {

    List<Clazz> list(ClazzQueryParam clazzQueryParam);


    void add(Clazz clazz);

    @Select("select * from clazz where id = #{id}")
    Clazz getInfo(Integer id);

    void update(Clazz clazz);


    @Delete("delete from clazz where id = #{id}")
    void deleteById(Integer id);

    @Select("select count(*) from student where clazz_id = #{id}")
    int getStudentCount(Integer id);

    @Select("select id,id, name, room, begin_date, end_date, master_id, subject, create_time, update_time from clazz")
    List<Clazz> selectAll();
}
